package org.dochandler.esfinge.guardian.authorizer;

import org.dochandler.service.domain.SituationOfState;
import org.dochandler.service.domain.annotation.MissionWithinBudget;
import org.dochandler.service.domain.constants.Constants;
import org.esfinge.guardian.authorizer.Authorizer;
import org.esfinge.guardian.context.AuthorizationContext;

public class WarMissionApprovalPolicyAuthorizer implements Authorizer<MissionWithinBudget> {

	@Override
	public Boolean authorize(AuthorizationContext context, MissionWithinBudget securityAnnotation) {
		SituationOfState sos = context.getEnvironment().get( Constants.SITUATION_OF_STATE.val(), SituationOfState.class );
		
		if (sos == SituationOfState.WAR) {
			return true;
		}
		return false;
		
	}

}